//
//  RBGroupListCell.m
//  zhongzhenglu
//
//  Created by XL on 2022/7/27.
//

#import "RBGroupListCell.h"
#import "RBDefine.h"
#import <UIColor+YYAdd.h>
#import "RBThemeConfig.h"
#import "UIView+RBAdd.h"
#import <UIView+YYAdd.h>
#import "UIImageView+RBAdd.h"

@interface RBGroupListCell()

@property(nonatomic, strong)IBOutlet UIImageView *imgView;
@property(nonatomic, strong)IBOutlet UILabel *nameL;
@property(nonatomic, strong)IBOutlet UILabel *numL;
@property(nonatomic, strong)IBOutlet UILabel *priceL;
@property(nonatomic, strong)IBOutlet UILabel *orgPriceL;
@property(nonatomic, strong)IBOutlet UILabel *buyBtn;

@property(nonatomic, strong) RBCellModel *cellModel;

@end

@implementation RBGroupListCell

- (void)awakeFromNib
{
    [super awakeFromNib];
    [self zoomSubViewsWithSelf];
}

- (void)setCellModel:(RBCellModel *)cellModel
{
    _cellModel = cellModel;
    RBGroupListModel *model = cellModel.cellData;
    [self.imgView setImageWithUrl:model.picurl placeHolder:nil];
    self.nameL.text = model.goods_title;
    self.numL.text = [NSString stringWithFormat:@"　%@人团　", model.group_people_max];
    [self.numL sizeToFit];
    self.numL.height = Zoom(18);
    [self.numL setRounderWithRectCorner:UIRectCornerTopLeft | UIRectCornerBottomRight radius:Zoom(9)];
    self.priceL.attributedText = [RanTool attributeStringMaker:^(NSMutableArray *maker) {
        [maker addAttributeStringWithFont:[UIFont boldSystemFontOfSize:11] color:[UIColor colorWithHexString:@"#F04D27"] string:@"¥"];
        [maker addAttributeStringWithFont:[UIFont boldSystemFontOfSize:15] color:[UIColor colorWithHexString:@"#F04D27"] string:model.group_price];
    }];
    self.orgPriceL.attributedText = [RanTool attributeStringMaker:^(NSMutableArray *maker) {
        [maker addAttributeStringWithFont:[UIFont systemFontOfSize:Zoom(12)] color:[RBThemeConfig textGrayColor] string:[NSString stringWithFormat:@"¥%@", model.goods_price] lineSpacing:0 througnLineHeight:1 throughLineColor:[RBThemeConfig textGrayColor]];
    }];
    self.buyBtn.text = [NSString stringWithFormat:@"　%@　",model.btn];
    self.buyBtn.backgroundColor = model.btn_status == 1? [UIColor colorWithHexString:@"E83922"]: [UIColor colorWithHexString:@"aaaaaa"];
}

@end
